{% block js %}
    <script>
        function reply_button_{{ comment.id }}() {
            var reply_html =
                '<div id="reply-{{ comment_id }}" class="comment_reply_textarea" style="margin-top: 3px;">' +
                '    <form action="{% url 'blog:comment_reply' blog.id comment_id %}" method="post" class="comment-form">' +
                '        <div class="vwrap">' +
                '            <div class="vheader item3">' +
                '                <input class="vlink vinput" name="name" placeholder="昵称" maxlength="25" required=""' +
                '                       id="id_name" type="text">' +
                '                <label for="id_name">{{ form.url.errors }}</label>' +
                '            </div>' +
                '            <div class="vheader item3">' +
                '                <input class="vlink vinput" name="email" placeholder="邮箱" maxlength="50"' +
                '                       id="id_email" type="email">' +
                '                <label for="id_email">{{ form.url.errors }}</label>' +
                '            </div>' +
                '            <div class="vheader item3">' +
                '                <input class="vlink vinput" name="url_input" placeholder="链接" maxlength="100"' +
                '                       id="id_url_input" type="url">' +
                '                <label for="id_url_input">{{ form.url.errors }}</label>' +
                '            </div>' +
                '            <div class="vedit">' +
                '                <textarea type="text" class="vediter vinput OwO-textarea" name="comment"' +
                '                          placeholder="在这里输入吧..."' +
                '                          maxlength="500" required="" id="id_comment" cols="40" rows="10"></textarea>' +
                '                <label for="id_comment">{{ form.comment.errors }}</label>' +
                '                <div class="OwO" style="width: 90%"></div>' +
                '                {% if user.is_authenticated %}' +
                    '                    <button class="vsubmit vbtn" type="submit">发表</button>' +
                    '                {% else %}' +
                    '                    <p>卡bug是吧，退！退！退！</p>' +
                    '                {% endif %}' +
                '            </div>' +
                '        </div>' +
                '    </form>' +
                '</div>';
            if (document.getElementById("reply-{{ comment_id }}")) {
                return true;
            } else {
                $(".comment_reply_textarea").remove();
                $(".reply_button_{{ comment_id }}").closest('div').append(reply_html);
            }
            new OwO({
                logo: 'OωO表情',
                container: document.getElementsByClassName('OwO')[1],
                target: document.getElementsByClassName('OwO-textarea')[1],
                api: '/static/OwO.json',
                position: 'up',
                width: '100%',
                maxHeight: '250px'
            });
        }
    </script>
{% endblock %}
